//首页轮播组件
import 'package:baixing/routers/application.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';

class SwiperDiy extends StatelessWidget {
  final List swiperDateList;

  SwiperDiy({this.swiperDateList});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: ScreenUtil().setHeight(333),
      width: ScreenUtil().setWidth(750),
      child: Swiper(
        itemCount: swiperDateList.length,
        itemBuilder: (BuildContext context, int index) {
          return GestureDetector(
            onTap: () {
              Application.router.navigateTo(
                  context, "detail?id=${swiperDateList[index]["goodsId"]}");
            },
            child: Image.network("${swiperDateList[index]["image"]}",
                fit: BoxFit.fill),
          );
        },
        pagination: SwiperPagination(),
        autoplay: true,
      ),
    );
  }
}
